package com.xiaotu.sys.serviceImpl;

import com.xiaotu.exception.CustomException;
import com.xiaotu.sys.pojo.entity.User;
import com.xiaotu.sys.mapper.UserMapper;
import com.xiaotu.sys.service.UserService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author xiaotu
 * @since 2022-01-19
 */
@Service
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements UserService {

    @Override
    public void empower(String userId, String[] roleIds) {
        if (userId == "" || userId == null || roleIds.length==0){
            throw new CustomException("信息不能为空");
        }
        baseMapper.empower(userId,roleIds);
    }

    @Override
    public User getUserAndRoles(String id) {
        User  use = baseMapper.getUserAndRoles(id);
        return use;
    }
}
